//
//  PlayerNameAddition.m
//  MapEdit
//
//  Created by Steven Canfield on 7/3/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "PlayerNameAddition.h"


@implementation NSArray ( PlayerNameAddition )
static NSArray * coloredNameArray = NULL;
+ (NSArray *)coloredTeamNames {
	if( coloredNameArray == NULL ) {
		NSArray * names = [NSArray arrayWithObjects:@"Red", @"Blue", @"Teal", @"Purple", @"Orange", @"White", @"Brown", @"Yellow", NULL];
		NSMutableArray *coloredNames = [[NSMutableArray alloc] init];
		for( NSString * name in names) {
			SEL colorSEL = NSSelectorFromString( [[name lowercaseString] stringByAppendingString:@"Color"] );
			NSColor * color = [NSColor performSelector:colorSEL];
			NSAttributedString * attr_name = [[NSAttributedString alloc] initWithString:name attributes:[NSDictionary dictionaryWithObjectsAndKeys:color, NSForegroundColorAttributeName, [color inverseColor], NSBackgroundColorAttributeName, NULL]];
			[coloredNames addObject: attr_name ];
		}
		
		coloredNameArray = [coloredNames copy];
	}
	return coloredNameArray;
}
@end
